<template>
    <div>
        <ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media" v-for="item in getnewslist" :key="item.id">
					<router-link :to="'/newslist/newsinfo/' + item.id">
						<img class="mui-media-object mui-pull-left" :src="item.img_url">
						<div class="mui-media-body">
							{{ item.title }}
							<p class='mui-ellipsis'>
                                <span>发表时间：{{ item.add_time | dataFormat}}</span>
                                <span>点击：{{ item.click }}次</span>
                            </p>
						</div>
					</router-link>
				</li>
			</ul>
    </div>
</template>

<script>
export default {
    data() {
        return {
            getnewslist:[]
        }
    },
    created() {
        this.getNewsList()
    },
    methods: {
        getNewsList(){
            this.$axios.get('api/getnewslist').then(res => {
                if(res.data.status === 0){
                    this.getnewslist = res.data.message
                }else{
                    Toast('请求出错');
                }
            })
        }
    },
}
</script>

<style scoped>
.mui-media-body{
    font-size: 14px;
}
.mui-ellipsis{
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    color: #64a6e4
}
.mui-ellipsis span:nth-child(2){
    color: grey;
}
.mui-media-body{
    text-overflow:ellipsis;   
    white-space:nowrap;
    overflow:hidden;
}
</style>